// src/router.js (更新后)
import { createRouter, createWebHistory } from 'vue-router'
import Home from './views/Home.vue'
import MyWorks from './views/MyWorks.vue'
import Login from './views/Login.vue'  // 导入登录页面
import Register from './views/Register.vue'  // 导入注册页面
import WorkDetail from './views/WorkDetail.vue'  // 导入作品详情页面

const routes = [
  {
    path: '/',
    name: 'Home',
    component: Home
  },
  {
    path: '/my-works',
    name: 'MyWorks',
    component: MyWorks
  },
  {
    path: '/login',
    name: 'Login',
    component: Login
  },
  {
    path: '/register',  // 注册页面路由
    name: 'Register',
    component: Register
  },
  {
    path: '/work/:id/view',
    name: 'WorkView',
    component: WorkDetail
  },
  {
    path: '/work/:id/edit',
    name: 'WorkEdit',
    // 暂时重定向到首页，后续可以替换为实际的作品编辑页面组件
    redirect: '/'
  }
]

const router = createRouter({
  history: createWebHistory(),
  routes
})

export default router